<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="cn.egame.common.model.PageData"%>
<%@page import="java.util.List"%>
<%@page import="cn.egame.ext.cu.ManufactureInfo"%>
<%@page import="com.egame.manage.biz.server.UserServiceImpl"%>
<%@page import="com.lenovo.manager.business.domain.UserBean"%>
<%@page import="com.egame.manage.biz.utils.ConstVar"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/common.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath() %>/css/main.css"  />
<script type="text/javascript">
	function addSubmit(){
		var td = $("#addform").find("td[name='notnone']");
		var isSubmit = true;
		for(var i = 0; i<td.length; i++){
			if($(td[i]).find("input").val() == "" || $(td[i]).find("input").val().length>50){
				$(td[i]).find("span").remove();
				$(td[i]).append("<span class='page_tip'>*必填，最多50个汉字字符</span>");
				isSubmit = false;
			}else{
				$(td[i]).find("span").remove();
			}
		}
		if(isSubmit){
			document.getElementById("addform").submit();
		}
	}
	function search(){
		document.getElementById("myform").action = "<%=request.getContextPath() + "/tv/manufacturer/list.do" %>";
		document.getElementById("myform").submit();
	}
</script>
<title>厂商列表</title>
</head>
<body>
<form action="" id="myform">	
<div class="matter_box">	
<h3 class="nopoint"><strong>厂商列表</strong></h3>

<div class="task_search">
<% 
	String nameSearch = "";
	if(request.getAttribute("nameSearch")!=null){
		nameSearch = (String)request.getAttribute("nameSearch");
	}
	String shortNameSearch = "";
	if(request.getAttribute("shortNameSearch")!=null){
		shortNameSearch = (String)request.getAttribute("shortNameSearch");
	}
	String enNameSearch = "";
	if(request.getAttribute("enNameSearch")!=null){
		enNameSearch = (String)request.getAttribute("enNameSearch");
	}
	String enShortSearch = "";
	if(request.getAttribute("enShortSearch")!=null){
		enShortSearch = (String)request.getAttribute("enShortSearch");
	}
%>
<label>厂商</label>
<input type=text name=nameSearch value=<%=nameSearch %>>
<label>品牌</label>
<input type=text name=shortNameSearch value=<%=shortNameSearch %>>
<label>英文名称</label>
<input type=text name=enNameSearch value=<%=enNameSearch %>>
<label>英文缩写</label>
<input type=text name=enShortSearch value=<%=enShortSearch %>>
<input type=button value="查询" onclick="search()" class="upload_btn">
</div>

	<div class="matter_box">		
		<p class="tr"><a class="btn2" href="javascript:setDialog('addManufacturer')">新增厂商</a></p>						
			<div class="mt10 pt10 clearfix">
			<table cellpadding="0" cellspacing="0" class="table2">
				<tr class="first">
					<th>序号</th>
					<th>厂商</th>
					<th>品牌</th>
					<th>英文名称</th>
					<th>英文缩写</th>
					<th>备注</th>
					<th>最终操作人</th>
					<th>操作</th>
				</tr>
	<%
		PageData pd = null;
		if(request.getAttribute("pd") != null){
			pd = (PageData)request.getAttribute("pd");
		}
		if(pd != null && pd.getContent() != null){
			List<ManufactureInfo> list = (List<ManufactureInfo>)pd.getContent();
			int i = 1;
			for(ManufactureInfo bean:list){
	%>
					<tr>
						<td><%=i++ %></td>
						<td><%=bean.getCnName() %></td>
						<td><%=bean.getShortName() %></td>
						<td><%=bean.getEnName() %></td>
						<td><%=bean.getEnShort() %></td>
						<td style="width: 250px;"><%=bean.getRemark() %></td>
						<td><%=UserServiceImpl.getInstance().getCnNameById(bean.getOperatorId())%></td>					
						<td>
							<a href="<%=request.getContextPath() + "/tv/manufacturer/edit/show.do?manufacturerId=" + bean.getManufactureId() %>">编辑</a>
							<a href="<%=request.getContextPath() + "/tv/manufacturer/delete.do?manufacturerId=" + bean.getManufactureId() %>">删除</a>
						</td>
					</tr>
				<%
			}
		}
	%>
</table>
<%@ include file="../page.in"  %> 
</div>
</div>
</form>
<div class="dialog_table editor_group" id="addManufacturer" style="width:400px">
	<h2 class="tc">新增厂商</h2>
	<form action="<%=request.getContextPath() + "/tv/manufacturer/set.do"%>" method="post" id="addform">
		<table>
			<tr>
				<td align="right">厂商:</td>
				<td class="pl25"  name="notnone">
					<input type=text name=cnName maxlength="50">
				</td>
			</tr>
			<tr>
				<td align="right">品牌:</td>
				<td class="pl25" name="notnone">
					<input type=text name=shortName maxlength="50">
				</td>
			</tr>
			<tr>
				<td align="right">英文名称:</td>
				<td class="pl25" name="notnone">
					<input type=text name=enName maxlength="50">
				</td>
			</tr>
			<tr>
				<td align="right">英文缩写:</td>
				<td class="pl25" name="notnone">
					<input type=text name=enShort maxlength="50">
				</td>
			</tr>
			
			<tr>
				<td align="right">备注:</td>
				<td class="pl25">
					<input type=text name=remark maxlength="50">
				</td>
			</tr>
			
			<tr>
				<td colspan=2 align="center">
					<input class="btn3" type="button" value="提交" onclick="addSubmit()">
				</td>			
			</tr>
		</table>
	</form>
</div>
</div>
</body>
</html>